-module(formatter_supervisor).
-behavior(supervisor).

-include("sew_app.hrl").

% External exports
-export([start_link/0]).

% supervisor callbacks
-export([init/1]).

start_link() ->
  supervisor:start_link(?MODULE, '_').

% formatters are assumed to create pg2s registered under their
% type-names (at the moment, markdown and sanitiser)
init(_Args) ->
  {ok,
   {{one_for_one,
     3,
     10},
    [{markdown_supervisor,
      {externalprogram_supervisor,
       start_link,
       [markdown,
        ?NO_OF_MARKDOWN_WORKERS,
        ?PATH_TO_MARKDOWN_WORKER]},
      permanent,
      _Timeout1=infinity,
      supervisor,
      [externalprogram_supervisor]},
     {sanitiser_supervisor,
      {externalprogram_supervisor,
       start_link,
       [sanitiser,
        ?NO_OF_MARKDOWN_WORKERS,
        ?PATH_TO_MARKDOWN_WORKER]},
      permanent,
      _Timeout2=infinity,
      supervisor,
      [externalprogram_supervisor]}]}}.